package com.lyf.boot.utils;

import org.springframework.util.PatternMatchUtils;

import java.util.Collection;

/**
 * @author liuxiu
 */
public class PathMatchUtil {

    public static boolean isMatch(String uri, Collection<String> whiteList) {
        for (String whiteUrl : whiteList) {
            if (PatternMatchUtils.simpleMatch("**" + whiteUrl, uri)) {
                return true;
            }
        }
        return false;
    }

    public static boolean isNotMatch(String uri, Collection<String> whiteList) {
        for (String whiteUrl : whiteList) {
            if (PatternMatchUtils.simpleMatch("**" + whiteUrl, uri)) {
                return false;
            }
        }
        return true;
    }
}
